package b2.scene.fight
{
	import b2.util.*;
	
	import flash.display.*;
	import flash.filters.*;
	import flash.geom.Matrix;
	
	public class ExternalImage
	{
		private static var _bitmapData:BitmapData;
	    private static var _id:String;
	    
	    public function ExternalImage()
	    {
	    }
	    
	    public static function setData(ImgClass:Class, id:String, width:int = 135, height:int = 135, filterMatrix:Array = null):void 
	    {
	    	
			_id = id;
			var imgSprite:Sprite = new ImgClass();
			imgSprite.filters = [new ColorMatrixFilter(filterMatrix)];
			imgSprite.width;
			_bitmapData = new BitmapData(width, height, true, 0);
			_bitmapData.draw(imgSprite);
 	    }
	    
	    public static function setAdaptData(ImgClass:Class, id:String, width:int = 135, height:int = 135, sWidth:int = 0, sHeight:int = 0,filterMatrix:Array = null):void 
	    {
	    	
			_id = id;
			var imgSprite:Sprite = new ImgClass();
			imgSprite.filters = [new ColorMatrixFilter(filterMatrix)];
			var m:Matrix = new Matrix();
			m.scale(sWidth / imgSprite.width, sHeight/imgSprite.height);
			_bitmapData = new BitmapData(width, height, true, 0);
			_bitmapData.draw(imgSprite, m);
 	    }
 	    
	    public static function toString():String 
		{
			return _id;
		}
	    
	    public function get bitmapData():BitmapData
	    {
			return _bitmapData;
		}
	}
}